{% extends "base.html" %}

{% block content %}
<div class="auth-container container">
    <div class="card auth-card">
        <h2>登录</h2>
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                {% for message in messages %}
                    <div class="alert">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        <form method="POST" action="{{ url_for('auth.login') }}">
            {{ form.hidden_tag() }}
            <div class="form-group">
                {{ form.username_or_email.label }}
                {{ form.username_or_email(class="form-control", placeholder="请输入用户名或邮箱") }}
                {% for error in form.username_or_email.errors %}
                <span class="error">{{ error }}</span>
                {% endfor %}
            </div>
            <div class="form-group">
                {{ form.password.label }}
                {{ form.password(class="form-control", placeholder="请输入密码") }}
                {% for error in form.password.errors %}
                <span class="error">{{ error }}</span>
                {% endfor %}
            </div>
            <div class="form-group checkbox">
                {{ form.remember_me() }} {{ form.remember_me.label }}
            </div>
            <button type="submit" class="btn">登录</button>
        </form>
        <div class="auth-links">
            <p>还没有账号？<a href="{{ url_for('auth.register') }}">立即注册</a></p>
        </div>
    </div>
</div>
{% endblock %} 